/**@Title   MailService.java
 * @Package com.gong.service
 * @Desc    
 * @Author  GongWenhua
 * @Date    2017年7月3日 上午10:06:15
 * @Version 1.0
*/
package com.gong.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

@Service
public class MailService {
	
	@Value("${spring.mail.username}")
	private String from;
	
	@Autowired
	private JavaMailSender sender;
	
	
	public void sendSimple(String to,String subject,String content){
		SimpleMailMessage message = new SimpleMailMessage();
		message.setFrom(from);
		message.setTo(to);
		message.setSubject(subject);
		message.setText(content);
		
		sender.send(message);
		System.out.println("Message Sended");
	}
}
